% 1 - ορισμός. Τι είναι το context-free grammars
Diclib.com
Διαδικτυακό λεξικό

Τι (ποιος) είναι context-free grammars - ορισμός

TYPE OF FORMAL GRAMMAR
Context free grammars; Context free grammar; Context-free grammars; Useless rules; Useless Rules; Proper grammar; Context-free Grammar; Content free grammar; Context free gramar; Rightmost derivation; Leftmost derivation; Left-sentential; Left sentential; Right-sentential; Right sentential; Context Free Grammar; Unreachable symbol; Unproductive symbol; Nonterminal nullability; Ε-production
  • C programming language]] (left), and a derivation of a piece of C code (right) from the nonterminal symbol <math>\langle\text{Stmt}\rangle</math>. Nonterminal symbols are blue and terminal symbols are red.
  • An example parse tree
  • Two different parse trees from the same input
  • 1 + 1 + a}}
  • 1 + 1 + a}}

Context-free grammar         
In formal language theory, a context-free grammar (CFG) is a formal grammar whose production rules are of the form
Probabilistic context-free grammar         
Probabilized context-free grammar; Weighted context-free grammar; Probabilistic context free grammar; PCFG; Probabilistic parsing; Stochastic context-free grammar; Applications of probabilistic context-free grammar
Grammar theory to model symbol strings originated from work in computational linguistics aiming to understand the structure of natural languages. Probabilistic context free grammars (PCFGs) have been applied in probabilistic modeling of RNA structures almost 40 years after they were introduced in computational linguistics.
Generalized context-free grammar         
ABSTRACT LANGUAGE THEORY CONCEPT
Linear context-free rewriting system; LCFRS; Linear context-free rewriting language; LCFRL; Linear context-free rewriting systems; GCFG
Generalized context-free grammar (GCFG) is a grammar formalism that expands on context-free grammars by adding potentially non-context-free composition functions to rewrite rules. Head grammar (and its weak equivalents) is an instance of such a GCFG which is known to be especially adept at handling a wide variety of non-CF properties of natural language.

Βικιπαίδεια

Context-free grammar

In formal language theory, a context-free grammar (CFG) is a formal grammar whose production rules can be applied to a nonterminal symbol regardless of its context. In particular, in a context-free grammar, each production rule is of the form

A     α {\displaystyle A\ \to \ \alpha }

with A {\displaystyle A} a single nonterminal symbol, and α {\displaystyle \alpha } a string of terminals and/or nonterminals ( α {\displaystyle \alpha } can be empty). Regardless of which symbols surround it, the single nonterminal A {\displaystyle A} on the left hand side can always be replaced by α {\displaystyle \alpha } on the right hand side. This distinguishes it from a context-sensitive grammar, which can have production rules in the form α A β α γ β {\displaystyle \alpha A\beta \rightarrow \alpha \gamma \beta } with A {\displaystyle A} a nonterminal symbol and α {\displaystyle \alpha } , β {\displaystyle \beta } , and γ {\displaystyle \gamma } strings of terminal and/or nonterminal symbols.

A formal grammar is essentially a set of production rules that describe all possible strings in a given formal language. Production rules are simple replacements. For example, the first rule in the picture,

Stmt Id = Expr ; {\displaystyle \langle {\text{Stmt}}\rangle \to \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;}

replaces Stmt {\displaystyle \langle {\text{Stmt}}\rangle } with Id = Expr ; {\displaystyle \langle {\text{Id}}\rangle =\langle {\text{Expr}}\rangle ;} . There can be multiple replacement rules for a given nonterminal symbol. The language generated by a grammar is the set of all strings of terminal symbols that can be derived, by repeated rule applications, from some particular nonterminal symbol ("start symbol"). Nonterminal symbols are used during the derivation process, but do not appear in its final result string.

Languages generated by context-free grammars are known as context-free languages (CFL). Different context-free grammars can generate the same context-free language. It is important to distinguish the properties of the language (intrinsic properties) from the properties of a particular grammar (extrinsic properties). The language equality question (do two given context-free grammars generate the same language?) is undecidable.

Context-free grammars arise in linguistics where they are used to describe the structure of sentences and words in a natural language, and they were invented by the linguist Noam Chomsky for this purpose. By contrast, in computer science, as the use of recursively-defined concepts increased, they were used more and more. In an early application, grammars are used to describe the structure of programming languages. In a newer application, they are used in an essential part of the Extensible Markup Language (XML) called the Document Type Definition.

In linguistics, some authors use the term phrase structure grammar to refer to context-free grammars, whereby phrase-structure grammars are distinct from dependency grammars. In computer science, a popular notation for context-free grammars is Backus–Naur form, or BNF.